home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / include / sched.h < prev    next >
C/C++ Source or Header  |  2008-09-29  |  5KB  |  121 lines

  1. /* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
  2.    Copyright (C) 1996,1997,1999,2001-2004,2007 Free Software Foundation, Inc.
  3.    This file is part of the GNU C Library.
  4.  
  5.    The GNU C Library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Lesser General Public
  7.    License as published by the Free Software Foundation; either
  8.    version 2.1 of the License, or (at your option) any later version.
  9.  
  10.    The GNU C Library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Lesser General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Lesser General Public
  16.    License along with the GNU C Library; if not, write to the Free
  17.    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18.    02111-1307 USA.  */
  19.  
  20. #ifndef    _SCHED_H
  21. #define    _SCHED_H    1
  22.  
  23. #include <features.h>
  24.  
  25. /* Get type definitions.  */
  26. #include <bits/types.h>
  27.  
  28. #define __need_size_t
  29. #include <stddef.h>
  30.  
  31. #define __need_timespec
  32. #include <time.h>
  33.  
  34. /* Get system specific constant and data structure definitions.  */
  35. #include <bits/sched.h>
  36. /* Define the real names for the elements of `struct sched_param'.  */
  37. #define sched_priority    __sched_priority
  38.  
  39.  
  40. __BEGIN_DECLS
  41.  
  42. /* Set scheduling parameters for a process.  */
  43. extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
  44.      __THROW;
  45.  
  46. /* Retrieve scheduling parameters for a particular process.  */
  47. extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW;
  48.  
  49. /* Set scheduling algorithm and/or parameters for a process.  */
  50. extern int sched_setscheduler (__pid_t __pid, int __policy,
  51.                    __const struct sched_param *__param) __THROW;
  52.  
  53. /* Retrieve scheduling algorithm for a particular purpose.  */
  54. extern int sched_getscheduler (__pid_t __pid) __THROW;
  55.  
  56. /* Yield the processor.  */
  57. extern int sched_yield (void) __THROW;
  58.  
  59. /* Get maximum priority value for a scheduler.  */
  60. extern int sched_get_priority_max (int __algorithm) __THROW;
  61.  
  62. /* Get minimum priority value for a scheduler.  */
  63. extern int sched_get_priority_min (int __algorithm) __THROW;
  64.  
  65. /* Get the SCHED_RR interval for the named process.  */
  66. extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
  67.  
  68.  
  69. #ifdef __USE_GNU
  70. /* Access macros for `cpu_set'.  */
  71. # define CPU_SETSIZE __CPU_SETSIZE
  72. # define CPU_SET(cpu, cpusetp)     __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
  73. # define CPU_CLR(cpu, cpusetp)     __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
  74. # define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
  75.                         cpusetp)
  76. # define CPU_ZERO(cpusetp)     __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
  77. # define CPU_COUNT(cpusetp)     __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
  78.  
  79. # define CPU_SET_S(cpu, setsize, cpusetp)   __CPU_SET_S (cpu, setsize, cpusetp)
  80. # define CPU_CLR_S(cpu, setsize, cpusetp)   __CPU_CLR_S (cpu, setsize, cpusetp)
  81. # define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
  82.                                cpusetp)
  83. # define CPU_ZERO_S(setsize, cpusetp)        __CPU_ZERO_S (setsize, cpusetp)
  84. # define CPU_COUNT_S(setsize, cpusetp)        __CPU_COUNT_S (setsize, cpusetp)
  85.  
  86. # define CPU_EQUAL(cpusetp1, cpusetp2) \
  87.   __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
  88. # define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
  89.   __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
  90.  
  91. # define CPU_AND(destset, srcset1, srcset2) \
  92.   __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
  93. # define CPU_OR(destset, srcset1, srcset2) \
  94.   __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
  95. # define CPU_XOR(destset, srcset1, srcset2) \
  96.   __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
  97. # define CPU_AND_S(setsize, destset, srcset1, srcset2) \
  98.   __CPU_OP_S (setsize, destset, srcset1, srcset2, &)
  99. # define CPU_OR_S(setsize, destset, srcset1, srcset2) \
  100.   __CPU_OP_S (setsize, destset, srcset1, srcset2, |)
  101. # define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
  102.   __CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
  103.  
  104. # define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
  105. # define CPU_ALLOC(count) __CPU_ALLOC (count)
  106. # define CPU_FREE(cpuset) __CPU_FREE (cpuset)
  107.  
  108.  
  109. /* Set the CPU affinity for a task */
  110. extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
  111.                   __const cpu_set_t *__cpuset) __THROW;
  112.  
  113. /* Get the CPU affinity for a task */
  114. extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
  115.                   cpu_set_t *__cpuset) __THROW;
  116. #endif
  117.  
  118. __END_DECLS
  119.  
  120. #endif /* sched.h */
  121.